public class Solution1 {
    //260. 只出现一次的数字 III
    public int[] singleNumber(int[] nums) {
        int target = 0;
        for (int num : nums) {
            target ^= num;
        }
        target &= -target;
        int[] ret = new int[2];
        for (int i = 0; i < nums.length; i++) {
            if ((nums[i] & target) == 0) {
                ret[0] ^= nums[i];
            } else {
                ret[1] ^= nums[i];
            }
        }
        return ret;
    }
}
